﻿<phone:PhoneApplicationPage 
    xmlns:local="clr-namespace:VodafoneLiveTile_2"
    local:TiltEffect.IsTiltEnabled="True"
    x:Class="VodafoneLiveTile_2.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:toolbox="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="696"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    Loaded="PhoneApplicationPage_Loaded"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    
    SupportedOrientations="PortraitOrLandscape" Orientation="Portrait"
    shell:SystemTray.IsVisible="True"
    BackKeyPress="PhoneApplicationPage_BackKeyPress">

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="0"/>
        </Grid.RowDefinitions>

        <!--TitlePanel contains the name of the application and page title-->
        <!--<StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="{Binding Path=Strings.Title, Source={StaticResource LocalizedStrings }}" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="{Binding Path=Strings.Account, Source={StaticResource LocalizedStrings }}" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
        </StackPanel>-->

        <controls:Pivot Title="{Binding Path=Strings.Title, Source={StaticResource LocalizedStrings }}" Name="PivotControl" IsHitTestVisible="True" SelectionChanged="PivotControl_SelectionChanged" Grid.Row="0">


            <controls:PivotItem Name="SettingsPivot_Name" Header="{Binding Path=Strings.Settings, Source={StaticResource LocalizedStrings }}" >

                <!--ContentPanel - place additional content here-->
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="500*" />

                    </Grid.RowDefinitions>
                    <ScrollViewer >

                        <StackPanel x:Name="StackPanel">
                            <Button Name="BuyComplete_Button" Content="{Binding Path=Strings.BuyComplete, Source={StaticResource LocalizedStrings }}" Click="BuyComplete_Button_Click" Visibility="Collapsed"/>
                            <toolbox:ToggleSwitch Name="LiveTile_Switch" Header="{Binding Path=Strings.EnableLiveTile, Source={StaticResource LocalizedStrings }}" Checked="LiveTile_Switch_Checked" Unchecked="LiveTile_Switch_Unchecked" />
                            <toolbox:ToggleSwitch Name="Toast_Switch" Header="{Binding Path=Strings.EnableToast, Source={StaticResource LocalizedStrings }}" Checked="Toast_Switch_Checked" Unchecked="Toast_Switch_Unchecked" />
                            <toolbox:ToggleSwitch Name="UpdateOnStart_Switch" Header="{Binding Path=Strings.UpdateOnStart, Source={StaticResource LocalizedStrings }}" Checked="UpdateOnStart_Switch_Checked" Unchecked="UpdateOnStart_Switch_Unchecked" />
                            <Button Name="CreateAccount_Button" Content="{Binding Path=Strings.CreateAccount, Source={StaticResource LocalizedStrings }}" Click="CreateAccount_Button_Click" Visibility="Visible"/>
                            <TextBlock  Name="Username_Text" Text="{Binding Path=Strings.Username, Source={StaticResource LocalizedStrings }}" FontSize="22" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                            <TextBox Name="Username_Area" FontSize="30"  TextAlignment="Center" KeyDown="Username_Area_KeyDown" />
                            <TextBlock  Name="Password_Text" Text="{Binding Path=Strings.Password, Source={StaticResource LocalizedStrings }}" FontSize="22" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                            <PasswordBox Name="Password_Area" FontSize="30" KeyDown="Password_Area_KeyDown" />
                            <toolbox:PerformanceProgressBar Name="ToggleProgressBar" Height="20" IsIndeterminate="False" IsEnabled="False" Visibility="Collapsed" />
                            <Button Name="CheckUserPassword_Button" Content="{Binding Path=Strings.CheckUserPass, Source={StaticResource LocalizedStrings }}" Click="CheckUserPassword_Button_Click"/>

                            <TextBlock Height="40" HorizontalAlignment="Left" Name="NumberChooser_Label" Text="{Binding Path=Strings.Number, Source={StaticResource LocalizedStrings }}" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Left" >
                                <toolbox:GestureService.GestureListener>
                                    <toolbox:GestureListener Tap="GestureListener_Tap" />
                                </toolbox:GestureService.GestureListener>
                            </TextBlock>

                            <Border Name="NumberChooser_Border" BorderThickness="3" Padding="6">
                                <toolbox:GestureService.GestureListener>
                                    <toolbox:GestureListener Tap="GestureListener_Tap" />
                                </toolbox:GestureService.GestureListener>
                                <toolbox:ContextMenuService.ContextMenu>
                                    <toolbox:ContextMenu Name="NumberChooser_Border_ContextMenu">

                                        <!--<toolbox:MenuItem Name="FirstPageChoose5_Name" Header="{Binding Path=Strings.Settings, Source={StaticResource LocalizedStrings }}" Click="FirstPageChoose_Click" />-->
                                    </toolbox:ContextMenu>
                                </toolbox:ContextMenuService.ContextMenu>
                                <TextBlock Name="NumberChooser_Area" Text="{Binding Path=Strings.Number, Source={StaticResource LocalizedStrings }}"  FontSize="26" TextAlignment="Center" />
                            </Border>

                            <TextBlock Height="40" HorizontalAlignment="Left" Name="ContractChooser_Label" Text="{Binding Path=Strings.Contract, Source={StaticResource LocalizedStrings }}" FontSize="24" FontStretch="Expanded" FontWeight="Normal" TextAlignment="Left" >
                                <toolbox:GestureService.GestureListener>
                                    <toolbox:GestureListener Tap="GestureListener_Tap" />
                                </toolbox:GestureService.GestureListener>
                            </TextBlock>

                            <!--<Border Name="ContractChooser_Border" BorderThickness="3" Padding="6">
                                <toolbox:GestureService.GestureListener>
                                    <toolbox:GestureListener Tap="GestureListener_Tap" />
                                </toolbox:GestureService.GestureListener>
                                <toolbox:ContextMenuService.ContextMenu>
                                    <toolbox:ContextMenu Name="ContractChooser_Border_ContextMenu">

                                        
                                    </toolbox:ContextMenu>
                                </toolbox:ContextMenuService.ContextMenu>
                                <TextBlock Name="ContractChooser_Area" Text=""  FontSize="26" TextAlignment="Center" />
                            </Border>-->
                            <Button Name="CounterChooser_Button" Content="" Click="CounterChooser_Click"/>
                            <TextBlock  Name="EmptyText" Text=" " FontSize="22" Height="50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Visible" TextAlignment="Center"/>
                            <Button Name="SuggestCounter_Button" Content="{Binding Path=Strings.SuggestCounter, Source={StaticResource LocalizedStrings }}" Click="SuggestCounter_Button_Click"/>
                            <toolbox:ToggleSwitch Name="Show_Date_Switch" Header="{Binding Path=Strings.Show_Date, Source={StaticResource LocalizedStrings }}" Checked="Show_Date_Switch_Checked" Unchecked="Show_Date_Switch_Unchecked" />

                            <!--<TextBlock  Name="Current_Step_Label" Text="" FontSize="22" Height="50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Collapsed" TextAlignment="Center"/>-->

                            <TextBlock  Name="RemainingTime_Label" Text="" FontSize="22" Height="50" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Visibility="Collapsed" TextAlignment="Center"/>

                            <Button Name="CancelUpdate_Button" Content="{Binding Path=Strings.Cancel, Source={StaticResource LocalizedStrings }}" Click="CancelUpdate_Button_Click" Visibility="Collapsed" />

                        </StackPanel>
                    </ScrollViewer>

                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Name="ToastsPivot_Name" Header="{Binding Path=Strings.Toasts, Source={StaticResource LocalizedStrings }}" >

                <Grid>

                    <!--<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser_History" VerticalAlignment="Top" Height="424" Width="454" Visibility="Collapsed" />-->
                    <ListBox x:Name="Toasts_List" Margin="0,0,-12,0" ItemsSource="{Binding Toasts}" SelectionChanged="Ads_List_SelectionChanged" SelectionMode="Single" Grid.Row="0" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <TextBlock Text="{Binding row1}" TextWrapping="NoWrap" Margin="12,0,0,0" Style="{StaticResource PhoneTextLargeStyle}"/>
                                    <TextBlock Text="{Binding row2}" TextWrapping="NoWrap" Margin="12,-6,0,0" Style="{StaticResource PhoneTextLargeStyle}"/>
                                    <TextBlock Text="{Binding datetime}" TextWrapping="Wrap" Margin="12,-6,0,0" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                </Grid>
            </controls:PivotItem>
            <controls:PivotItem Name="AdsPivot_Name" Header="{Binding Path=Strings.OtherProducts, Source={StaticResource LocalizedStrings }}" >

                <Grid>

                    <!--<phone:WebBrowser HorizontalAlignment="Left" Name="webBrowser_History" VerticalAlignment="Top" Height="424" Width="454" Visibility="Collapsed" />-->
                    <ListBox x:Name="Ads_List" Margin="0,0,-12,0" ItemsSource="{Binding Ads}" SelectionChanged="Ads_List_SelectionChanged" SelectionMode="Single" Grid.Row="0" >
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                                <StackPanel Margin="0,0,0,17">
                                    <Image Source="{Binding ImageUri}" Width="60" Height="60" Margin="60,0,0,0" HorizontalAlignment="Left" />
                                    <TextBlock Text="{Binding Name}" TextWrapping="NoWrap" Margin="150,-70,0,0" Width="300" Style="{StaticResource PhoneTextLargeStyle}"/>
                                    <TextBlock Text="{Binding Description}" TextWrapping="Wrap" Margin="150,-25,0,0" Width="300" Style="{StaticResource PhoneTextSubtleStyle}"/>
                                </StackPanel>
                            </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

                </Grid>
            </controls:PivotItem>
        </controls:Pivot>
    </Grid>

    <!--Sample code showing usage of ApplicationBar-->
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBar.MenuItems>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>